package wei.xinya.springwebflux.reactor;

import java.util.Observable;

public class ObserverDemo extends Observable {
    public static void main(String[] args) {
        ObserverDemo observerDemo = new ObserverDemo();

        observerDemo.addObserver(((o, arg) -> System.out.println("收到通知, 参数：" + arg)));
        observerDemo.addObserver(((o, arg) -> System.out.println("收到通知, 参数：" + arg)));

        observerDemo.setChanged();
        boolean hasChanged1 = observerDemo.hasChanged();
        System.out.println(hasChanged1);
        observerDemo.notifyObservers(123);
        boolean hasChanged2 = observerDemo.hasChanged();
        System.out.println(hasChanged2);
    }
}
